using System;
using SpecificationPatternCode.Contracts;

namespace SpecificationPatternCode.BaseSpecs
{
	public class LessThanSpecification<T> : ISpecification<T> where T : IComparable<T>
	{
		private readonly T _upper;

		public LessThanSpecification(T upper)
		{
			_upper = upper;
		}

		public bool IsSatisfiedBy(T candidate)
		{
			return candidate.CompareTo(_upper) < 1;
		}
	}
}